<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login</title>
<script type="text/javascript" language="javascript">
window.onload=function(){
	document.getElementById("form").onsubmit=function(){
		return checkForm();
	};
};
function checkForm(){
	var username = document.getElementById("username").value;
	var password = document.getElementById("password").value;
	var iderrormsg = document.getElementById("iderrormsg");
	var regex = /^\S+$/;
	if(!regex.test(username)){
		iderrormsg.textContent = "username?";
		return false;
	}
	if(!regex.test(password)){
		iderrormsg.textContent = "password?";
		return false;
	}
	return true;
}

</script>
</head>
<body>
<jsp:include page="header.jsp" />
<br><font color="red" size="14pt">${msg }</font>
<br>
<a href="addSession">添加Session(只是模拟,添加session后,才能阻止拦截器拦截,进行正常登录)</a><br>
<a href="removeSession">移除Session</a>
<br>
<s:fielderror ></s:fielderror>
<form id="form" action="login" method="post"> 
<table>
<tr><td>用户名：</td><td><input id="username" type="text" name="user.username" /></td></tr>
<tr><td>密码：</td><td><input id="password" type="password" name="user.password"></td></tr>
<tr><td><input type="reset" value="重置"></td><td><input type="submit" value="登录"></td></tr>
<tr><td></td><td></td></tr>
</table>
</form>
<label id="iderrormsg" style="color: red"></label>
</body>
</html>

